import React,{Component} from 'react';
import {Card, List, Avatar} from 'antd';
import TxtTag from '../txtTag';
import {Link} from 'react-router-dom';
export default class ReplyList extends Component{
	render(){
		let {replies, replyCount, loading} = this.props;
		return(
			<Card 
				title={replyCount+'条回复'}
				type="inner"
			>
				<List loading={loading}
					className="replyList"
					dataSource={replies}
					itemLayout="vertical"
					renderItem = {item => (
						<List.Item 
							key={item.id}
							extra={item.ups.length>0?'有'+item.ups.length+'人觉得这个回复很赞':''}
							>
							<List.Item.Meta
								avatar={<Avatar src={item.author.avatar_url}/>}
								description={<div>
									<Link to={"/user/"+item.author.loginname}>{item.author.loginname}</Link>
									<span style={{marginLeft:'5px'}}>发表于：{item.create_at.split('T')[0]}</span>
								</div>}
							/>
							<div dangerouslySetInnerHTML={{
								__html:item.content
							}}>
							</div>
						</List.Item>)}
					>
				</List>
			</Card>
		)
	}
}